package com.xnyzc.lhy.mis.controller.cmsapi.vehicle;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.result.cms.veh.VehicleManageInfo;
import com.xnyzc.lhy.mis.entity.vehicle.OaCVehicleInsurance;
import com.xnyzc.lhy.mis.entity.vehicle.OaSysVehicle;
import com.xnyzc.lhy.mis.service.cms.vehicle.VehicleManageService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhaolijie
 * @date 2019-08-24
 */
@RestController
@RequestMapping(value = "/cmsapi/vehicle")
public class VehicleManageController {

    @Autowired
    private VehicleManageService vehicleManageService;

    @GetMapping(value = "/getVehicleInsuranceByVeho")
    public Rv getVehicleInsuranceInfo(String veho){
        return vehicleManageService.getVehicleInsuranceInfoByVeho(veho);
    }
    /**
     * 车辆保险的crud操作
     * @param oaSysVehicleInsur
     * @return
     */
    @PostMapping(value = "/vehicleInsuranceOperate")
    public Rv vehicleInsuranceOperate(@RequestBody OaCVehicleInsurance oaSysVehicleInsur){
        return vehicleManageService.vehicleInsuranceOperate(oaSysVehicleInsur);
    }

    /**
     * 分页获取车辆信息
     *
     * @param vehicleManageInfo
     * @return
     */
    @PostMapping(value = "/getVehicleList")
    public Rv getVehicleList(
            @RequestBody VehicleManageInfo vehicleManageInfo
    ) {
        return vehicleManageService.getVehicleList(vehicleManageInfo);
    }

    /**
     * 查询车辆详情
     *
     * @return
     */
    @GetMapping(value = "/getVehicleDetails")
    public Rv getVehicleDetails(Long vehicleId) {
        return vehicleManageService.getVehicleDetails(vehicleId);
    }

    /**
     * 获取司机信息
     *
     * @return
     */
    @GetMapping(value = "/getDriverInfo")
    public Rv getDriverInfo(Integer current, Integer pageSize, String driverName,String driverPhone) {
        return vehicleManageService.getDriverInfo(current, pageSize, driverName,driverPhone);
    }

    /**
     * 查询车辆颜色
     *
     * @return
     */
    @GetMapping(value = "/findVehicleColor")
    public Rv findVehicleColor() {
        return vehicleManageService.findVehicleColor();
    }

    /**
     * 添加部分车辆信息
     *
     * @return
     */
    @PostMapping(value = "/addVehicle")
    public Rv addVehicle(@RequestBody OaSysVehicle oaSysVehicle) {
        return vehicleManageService.addVehicle(oaSysVehicle);
    }

    /**
     * 新增车辆信息
     *
     * @return
     */
    @PostMapping(value = "/addNewVehicle")
    public Rv addNewVehicle(@RequestBody OaSysVehicle oaSysVehicle) {
        return vehicleManageService.addNewVehicle(oaSysVehicle);
    }

    /**
     * 修改车辆信息
     *
     * @return
     */
    @PostMapping(value = "/updateVehicle")
    public Rv updateVehicle(@RequestBody VehicleManageInfo vehicleManageInfo) {
        return vehicleManageService.updateVehicle(vehicleManageInfo);
    }


    /**
     * 查询数据导出Excel
     *
     * @return
     */
    @PostMapping(value = "/exportGetVehicle")
    public Rv exportGetVehicle(
            @RequestBody VehicleManageInfo vehicleManageInfo
    ) {
        return vehicleManageService.exportGetVehicle(vehicleManageInfo);
    }

    /**
     * 品牌车系数据查询拼接
     *
     * @return
     */
    @GetMapping(value = "/brandCarSystem")
    public Rv brandCarSystem() {
        return vehicleManageService.brandCarSystem();
    }


}
